<template>
  <h1>一个人的信息</h1>
  <h2>姓名:{{ person.name }}</h2>
  <h2>年龄:{{ person.age }}</h2>
  <button @click="test">测试触发一下Demo组件的hello事件</button>

</template>

<script>
import {reactive} from 'vue'

export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: 'Demo',
  // beforeCreate() {
  //   console.log('--beforeCreate---')
  // },
  props:['msg','school'],
  emits:['hello'],
  setup: function (props,context) {
    // console.log(context)
    console.log(context.slots)



    let person = reactive({
      name: '张三',
      age: 18,
    })

    function test(){
      context.emit('hello','123123')

    }


    //返回一个函数（常用）
    return {
      person: person,
      test:test

    }
  }
}
</script>


